SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../CMakeFiles/")

#Add source directory to project.
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/Modules/Interface)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/Modules/IO)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/Modules/IO/Image)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/Modules/Utility)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/Modules/ThirdParty/niftilib)

# sources
SET( CVis_Sources
       
# header files
${PROJECT_SOURCE_DIR}/Modules/Interface/CommandLine/CVisCommandLineInterface.h
${PROJECT_SOURCE_DIR}/Modules/Utility/CVisUtility.h
${PROJECT_SOURCE_DIR}/Modules/Utility/CVisUtility.hpp
${PROJECT_SOURCE_DIR}/Modules/DataStructure/CVisImage.h
${PROJECT_SOURCE_DIR}/Modules/DataStructure/CVisImage.hpp
${PROJECT_SOURCE_DIR}/Modules/DataStructure/CVisMatrix.h
${PROJECT_SOURCE_DIR}/Modules/DataStructure/CVisMatrix.hpp
${PROJECT_SOURCE_DIR}/Modules/DataStructure/CVisPointCloud.h
${PROJECT_SOURCE_DIR}/Modules/DataStructure/CVisPointCloud.hpp
${PROJECT_SOURCE_DIR}/CVis/CVis.h

# source files 
${PROJECT_SOURCE_DIR}/Modules/Interface/CommandLine/CVisCommandLineInterface.cpp
${PROJECT_SOURCE_DIR}/CVis/CVis.cpp

)

# links
LINK_DIRECTORIES (${PROJECT_SOURCE_DIR}/lib)
 
# dependent libs
OPTION( BUILD_CORE_IMAGING "Build CVis's imaging libraries" YES )

#Third Party Libraries
FIND_PACKAGE( Boost REQUIRED COMPONENTS filesystem system)
IF (Boost_FOUND)
    INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
    ADD_DEFINITIONS(-DHAVE_BOOST)
    LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
    SET(Boost_FOUND TRUE)
ENDIF(Boost_FOUND)

ADD_DEFINITIONS(-DCVisImageIO_SUPPORT)

#Rule to build executable program
ADD_EXECUTABLE(cvis ${CVis_Sources})
TARGET_LINK_LIBRARIES(cvis ${CVisImageIO_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} )

ADD_DEPENDENCIES(cvis CVisImageIO)
